//package com.info.zhiduoduo.admin.controller;
//
//import com.info.zhiduoduo.admin.model.formbean.crowdsource.UploadProjectFileUrlFormBean;
//import com.info.zhiduoduo.admin.model.formbean.entrust.*;
//import com.info.zhiduoduo.admin.service.EntrustProjectService;
//import com.info.zhiduoduo.common.annotation.LogEntity;
//import com.info.zhiduoduo.common.annotation.LogParameter;
//import com.info.zhiduoduo.common.annotation.ZddLog;
//import com.info.zhiduoduo.common.constants.SmartResult;
//import com.info.zhiduoduo.common.constants.project.ProjectType;
//import com.info.zhiduoduo.common.constants.system.ZddLogType;
//import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;
//import com.info.zhiduoduo.common.utils.DateUtil;
//import com.info.zhiduoduo.core.service.common.ContractDocService;
//import com.info.zhiduoduo.core.service.common.DocService;
//import com.info.zhiduoduo.core.vo.entrustmentproject.ImportResultVO;
//import com.info.zhiduoduo.repository.dto.entrustmentproject.EntrustmentProjectDto;
//import com.info.zhiduoduo.repository.dto.entrustmentproject.EntrustmentProjectItemDto;
//import com.info.zhiduoduo.repository.dto.entrustmentproject.EntrustmentProjectMakerDto;
//import com.info.zhiduoduo.repository.dto.entrustmentproject.ProjectEntrusteeInfoDto;
//import com.info.zhiduoduo.repository.dto.project.SameProjectDto;
//import com.info.zhiduoduo.repository.entity.entrustmentproject.EntrustmentProject;
//import com.info.zhiduoduo.repository.entity.entrustmentproject.EntrustmentProjectItem;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.format.annotation.DateTimeFormat;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RequestPart;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.util.Date;
//
//import javax.servlet.http.HttpServletResponse;
//import javax.validation.Valid;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//
//@Api(tags = "委托发单模式")
//@RestController
//@RequestMapping("/entrustmentProject")
//public class EntrustProjectController {
//
//	@Autowired
//	EntrustProjectService entrustProjectService;
//	@Autowired
//	DocService docService;
//	@Autowired
//	ContractDocService contractDocService;
//
//	@ApiOperation("获取导入列表")
//	@PostMapping("/listProjects")
//	public SmartResult<EntrustmentProjectDto> listProjects(@RequestBody BaseSimpleFormBean<ListEntrustmentProjectFormBean> formBean) {
//		return entrustProjectService.listProjects(formBean);
//	}
//
//	@ApiOperation("导入委托发单项目( )")
//	@PostMapping("/importProjects")
//	public SmartResult<ImportResultVO> importProjects(@RequestPart MultipartFile file, ImportEntrustProjectsFormBean formBean) {
//		return entrustProjectService.importProjects(file, formBean, ProjectType.ENTRUST_ZHIDUODUO);
//	}
//
//	@ApiOperation("导入委托发单项目(智众包)")
//	@PostMapping("/importCrowdsourceProjects")
//	public SmartResult<ImportResultVO> importCrowdsourceProjects(@RequestPart MultipartFile file, ImportEntrustProjectsFormBean formBean) {
//		return entrustProjectService.importProjects(file, formBean, ProjectType.ENTRUST_CROWDSOURCE);
//	}
//
//	@ApiOperation("下载历史已上传的项目文件")
//	@GetMapping("/downlaodHistoryProjectFile")
//	public ResponseEntity<?> downlaodHistoryProjectFile(@ApiParam("批量导入id") @RequestParam int importId) {
//		return entrustProjectService.downloadHistoryProjectFile(importId);
//	}
//
//	@ZddLog(type = ZddLogType.UPDATE,name = "编辑子项目, 只能编辑状态为草稿或支付失败的",entities = @LogEntity(entity = EntrustmentProjectItem.class,parameters =
//	@LogParameter(fields = "id",parameters = "formBean.reqdata.id")))
//	@ApiOperation("编辑子项目, 只能编辑状态为草稿或支付失败的")
//	@PostMapping("/editProjectItem")
//	public SmartResult editProjectItem(@RequestBody BaseSimpleFormBean<EditProjectItemFormBean> formBean) {
//		return entrustProjectService.editProjectItem(formBean);
//	}
//
//	@ApiOperation("获取子项目列表")
//	@PostMapping("/listProjectItems")
//	public SmartResult<EntrustmentProjectItemDto> listProjectItems(
//			@RequestBody BaseSimpleFormBean<ListEntrustmentProjectItemFormBean> formBean) {
//		return entrustProjectService.listProjectItems(formBean);
//	}
//
//	@ApiOperation("获取子项目列表")
//	@GetMapping("/exportProjectItems")
//	public void exportProjectItems(HttpServletResponse response, @ApiParam("委托项目id") @RequestParam int importId,
//	                               @ApiParam("搜索企业名,项目名,付款方姓名,收款人姓名,手机号,收款账号") @RequestParam(required = false) String name,
//	                               @DateTimeFormat(pattern = DateUtil.FORMAT_STYLE_2) @ApiParam("日期开始yyyy-MM-dd") @RequestParam(required =
//			                               false) Date from,
//	                               @DateTimeFormat(pattern = DateUtil.FORMAT_STYLE_2) @ApiParam("日期结束yyyy-MM-dd") @RequestParam(required =
//			                               false) Date to,
//	                               @ApiParam("支付状态 0：全部 1：成功 2：失败") @RequestParam(required = false, defaultValue = "0") int state) {
//		entrustProjectService.exportProjectItems(response, importId, name, from, to, state);
//	}
//
//	@ApiOperation(value = "删除草稿项目", notes = "reqdata 为 importId")
//	@PostMapping("/removeProject")
//	public SmartResult removeProject(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return entrustProjectService.removeProject(formBean);
//	}
//
//	@ApiOperation("删除草稿子项目")
//	@PostMapping("/removeProjectItems")
//	public SmartResult removeProjectItems(@RequestBody BaseSimpleFormBean<String> formBean) {
//		return entrustProjectService.removeProjectItems(formBean);
//	}
//
////	@ZddLog(type = ZddLogType.UPDATE,name = "提交项目",entities = @LogEntity(entity = EntrustmentProject.class,parameters =
////	@LogParameter(fields = "importId",parameters = "formBean.reqdata")))
//	@ApiOperation(value = "提交项目", notes = "importId, 只能是草稿状态下, 提交后,才能给子项目分配受托人")
//	@PostMapping("/submit")
//	public SmartResult submit(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return entrustProjectService.submit(formBean);
//	}
//
//	@ApiOperation("编辑提交后的子项目(只能修改项目名、项目内容和发票内容)")
//	@PostMapping("/editProjectItemAfterSumbit")
//	public SmartResult editProjectItemAfterSumbit(@Valid @RequestBody BaseSimpleFormBean<EditProjectItemAfterSubmitFormBean> formBean) {
//		return entrustProjectService.editProjectItemAfterSubmit(formBean);
//	}
//
//	@ApiOperation("给项目分配受托人(创客)")
//	@PostMapping("/dispatchEntrustees")
//	public SmartResult dispatchEntrustees(@RequestBody BaseSimpleFormBean<DispatchEntrusteeFormBean> formBean) {
//		return entrustProjectService.dispatchEntrustees(formBean);
//	}
//
//	@ApiOperation("查询上一次企业发单项目的创客")
//	@PostMapping("/queryLastProjectMaker")
//	public SmartResult<EntrustmentProjectMakerDto> queryLastProjectMaker(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return entrustProjectService.queryLastProjectMaker(formBean.getReqdata());
//	}
//
//	@ApiOperation("下载委托接单子项目合同")
//	@GetMapping("/downloadEntrustProjectContract")
//	public void downloadEntrustProjectContract(HttpServletResponse response,
//	                                           @ApiParam("委托接单子项目id") @RequestParam("projectItemId") int projectItemId) {
//		entrustProjectService.downloadEntrustProjectContract(response, projectItemId);
//	}
//
//	@ApiOperation("获取企业历史委托接单列表")
//	@PostMapping("/queryHistoryProjects")
//	public SmartResult queryCompanyHistoryProjects(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return entrustProjectService.queryCompanyHistoryProjects(formBean);
//	}
//
//	@ApiOperation("获取委托项目委托信息")
//	@PostMapping("/listProjectEntrusteeInfo")
//	public SmartResult<ProjectEntrusteeInfoDto> listProjectEntrustmentInfo(@RequestBody BaseSimpleFormBean<Integer> formBean) {
//		return entrustProjectService.listProjectEntrustmentInfo(formBean);
//	}
//
//	@ApiOperation("下载委托接单项目创客合同文件-zip包(包含所有创客)")
//	@GetMapping("/downloadProjectEntrusteeContractZipFile")
//	public void downloadProjectEntrusteeContractZipFile(HttpServletResponse response, @RequestParam int projectid) {
//		entrustProjectService.downloadProjectEntrusteeContractZipFile(response, projectid);
//	}
//	@ApiOperation(" 下载委托接单项目创客合同文件-zip包(包含所有创客)")
//	@GetMapping("/zddDownloadProjectEntrusteeContractZipFile")
//	public void zddDownloadProjectEntrusteeContractZipFile(HttpServletResponse response, @RequestParam int projectid) {
//		entrustProjectService.zddDownloadProjectEntrusteeContractZipFile(response, projectid);
//	}
//
//	@ApiOperation("下载委托接单创客合同文件")
//	@GetMapping("/downloadProjectEntrusteeContractFile")
//	public void downloadProjectEntrusteeContractFile(HttpServletResponse response, @RequestParam int projectid, int entrusteeId) {
//		entrustProjectService.downloadProjectEntrusteeContractFile(response, projectid, entrusteeId);
//	}
//
//	@ApiOperation("下载委托接单项目创客合同pdf文件-zip包(包含所有创客)")
//	@GetMapping("/downloadEntrustContractPdfZip")
//	public void downloadEntrustContractPdfZip(HttpServletResponse response, @RequestParam int projectid) {
//		contractDocService.downloadEntrustContractZip(response, projectid);
//	}
//
//	@ApiOperation("下载委托接单创客合同pdf文件")
//	@GetMapping("/downloadEntrustContractPdf")
//	public void downloadEntrustContractPdf(HttpServletResponse response, @RequestParam int projectid, int entrusteeId) {
//		contractDocService.downloadEntrustContract(response, projectid, entrusteeId);
//	}
//
//	@ApiOperation("批量下载委托接单项目创客合同pdf文件-zip包(传大项目ids)")
//	@GetMapping("/batchDownloadEntrustContractPdfZip")
//	public void batchDownloadEntrustContractPdfZip(HttpServletResponse response, @RequestParam String projectIds) {
//		contractDocService.batchDownloadEntrustContractPdfZip(response, projectIds);
//	}
//
//	@ApiOperation("按年月获取企业历史委托接单列表")
//	@PostMapping("/monthlyQueryCompanyHistoryProjects")
//	public SmartResult monthlyQueryCompanyHistoryProjects(@RequestBody BaseSimpleFormBean<MonthlyQueryCompanyHistoryProjectsFormBean> formBean) {
//		return entrustProjectService.monthlyQueryCompanyHistoryProjects(formBean);
//	}
//
//	@ApiOperation("下载支付宝回单zip包-projectid为大项目id")
//	@GetMapping("/downloadEreceiptZipFile")
//	public void downloadEreceiptZipFile(HttpServletResponse response, int projectId) {
//		entrustProjectService.downloadEreceiptZipFile(response, projectId);
//	}
//
//	@ApiOperation("下载委托接单创客合同pdf")
//	@GetMapping("/downloadTheCommissionMakerContractPdf")
//	public void downloadTheCommissionMakerContractPdf(HttpServletResponse response, @RequestParam int projectid, int entrusteeId) {
//		entrustProjectService.downloadTheCommissionMakerContractPdf(response, projectid, entrusteeId);
//	}
//
//	@ApiOperation("下载委托接单项目创客合同pdf-zip包(包含所有创客)")
//	@GetMapping("/downloadProjectMakerContractZipPDF")
//	public void downloadProjectMakerContractZipPDF(HttpServletResponse response, @RequestParam int projectid) {
//		entrustProjectService.downloadProjectMakerContractZipPDF(response, projectid);
//	}
//
//	@ApiOperation("委托接单发相同单检测")
//	@PostMapping("/checkSameProject")
//	public SmartResult<SameProjectDto> checkSameProject(@RequestBody BaseSimpleFormBean<CheckSameProjectFormBean> formBean) {
//		return entrustProjectService.checkSameProject(formBean);
//	}
//
//	@ApiOperation("上传项目证据链")
//	@PostMapping("/uploadProjectFileUrl")
//	public SmartResult uploadAttachmentUrl(@RequestBody BaseSimpleFormBean<UploadProjectFileUrlFormBean> formBean) {
//		return entrustProjectService.uploadProjectFileUrl(formBean);
//	}
//}
